package com.youlai.boot.modules.delivery.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.youlai.boot.modules.delivery.model.Delivery;
import com.youlai.boot.modules.delivery.model.DeliveryVO;
import com.youlai.boot.modules.delivery.model.DeliveryPageQuery;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface DeliveryMapper extends BaseMapper<Delivery> {
    Page<DeliveryVO> getDeliveryPage(Page<DeliveryVO> page, @Param("query") DeliveryPageQuery query);

    List<DeliveryVO> getProductDeliveries(@Param("productId") Long productId);


    Page<DeliveryVO> getProductDeliveryPage(@Param("page") Page<DeliveryVO> page, @Param("productId") Long productId);

    boolean saveProductDelivery(@Param("productId") Long productId, @Param("deliveryId") Long deliveryId);

    boolean deleteProductDelivery(@Param("productId") Long productId, @Param("deliveryId") Long deliveryId);

    /**
     * 检查商品和物流公司关联关系是否存在
     * 
     * @param productId 商品ID
     * @param deliveryId 物流公司ID
     * @return 是否存在关联关系
     */
    boolean checkProductDeliveryExists(@Param("productId") Long productId, @Param("deliveryId") Long deliveryId);
}
